<?php
$ngaythi=$donvi='x';

if($_GET['ngaythi']!="")
    $ngaythi=$_GET['ngaythi'];
if($_GET['donvi']!="")
    $donvi=$_GET['donvi'];
    
include('../../configs/connect.php');   
 mysql_query("SET NAMES 'UTF8'");
 
 
    $sql="  SELECT 	ngayhoc_ctlm,count(ma_chitiet_lopmon) as tong 
            FROM 	tbl_chitiet_lopmon,tbl_lopmon 
            WHERE 	tbl_chitiet_lopmon.ma_lopmon=tbl_lopmon.ma_lopmon
            AND	    (madm_ttctlm='thilan1' OR madm_ttctlm='thilan2')
            AND 	ngayhoc_ctlm='$ngaythi'
            AND     ma_donvi='$donvi'";
         


$q=mysql_query($sql);
echo mysql_error();
$myarray=array();
$str="";
while($nt=mysql_fetch_array($q)){
$str=$str ."\"$nt[ngayhoc_ctlm]\"".","."\"$nt[tong]\"".",";
}
$str=substr($str,0,(strLen($str)-1)); // Removing the last char , from the string
echo "new Array($str)";

?>